#include "mainwindow.h"

#include <QAction>
#include <QDebug>
#include <QIconEngine>
#include <QMenu>
#include <QMenuBar>
#include <QToolBar>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
}

MainWindow::~MainWindow()
{
}

void MainWindow::init()
{
    setMinimumWidth(240);
    {
        QIcon dd;
        QStringList ps = dd.themeSearchPaths();

        ps.append(".local/share/icons");
        ps.append("/usr/share/icons");
        ps.append("/usr/local/share/icons");
        ps.append(":/icons");
        dd.setThemeSearchPaths(ps);
        dd.setFallbackSearchPaths(QStringList(":/icons"));
        // dd.setThemeName("ukui-icon-theme-default");
        qWarning() << "[=== checkmode ===]"
                   << "themeSearchPaths" << dd.themeSearchPaths();
        qWarning() << "[=== checkmode ===]"
                   << "fallbackSearchPaths" << dd.fallbackSearchPaths();
        qWarning() << "[=== checkmode ===]"
                   << "fallbackThemeName" << dd.fallbackThemeName();
        qWarning() << "[=== checkmode ===]"
                   << "themeName" << dd.themeName();
        QMenu *fileMenu = menuBar()->addMenu(tr("&Exit"));
        const QIcon exitIcon = dd.fromTheme("system-file-manager");
        QAction *exitAct = fileMenu->addAction(exitIcon, tr("E&xit"), this, &QWidget::close);

        QToolBar *editToolBar = addToolBar(tr("Edit"));
        const QIcon cutIcon = dd.fromTheme("application-exit");
        QAction *cutAct = new QAction(cutIcon, tr("Cu&t"), this);
        cutAct->setStatusTip(tr("Cut the current selection's contents to the clipboard"));
        editToolBar->addAction(cutAct);
    }
}
